package com.nsgf.library.data.bean;

import android.view.View;

import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;

import com.nsgf.library.BR;
import com.nsgf.library.utils.StringUtil;

import java.util.List;

public class MessageBean {

    /**
     * code : 200
     * msg : success
     * data : [{"id":"1826154065394925523","businessCode":"1223","type":"message.type.1","typeDesc":"流程审批","title":"工程巡查","content":"2024-08-20水库大坝巡查工单已完成审批！","userId":1000017,"isRead":0,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"isDelete":0},{"id":"1826154065394925524","businessCode":"1223","type":"message.type.1","typeDesc":"流程审批","title":"异常问题","content":"2024-08-20异常问题工单已完成审批！","userId":1000017,"isRead":0,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"isDelete":0},{"id":"1826154065394925525","businessCode":"1223","type":"message.type.2","typeDesc":"通知公告","title":"高淳区开展水库专项检查","content":"为确保全区水库安全度汛，区水务局于4月7日至11日对境内23座中小型水库逐一开展专项检查，重点围绕安全管理责..","userId":1000017,"isRead":0,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"isDelete":0}]
     */

    private int code;
    private String msg;
    private List<DataBean> data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean extends BaseObservable {

        private String id;
        private String businessCode;
        private String type;
        private String typeName;
        private String title;
        private String content;
        private int userId;
        private int isRead;
        private Object createBy;
        private String createTime;
        private Object updateBy;
        private Object updateTime;
        private int isDelete;

        private int approvalNum;
        private int noticeNum;
        private String warnType;
        private String warnTypeName;
        /**
         * waterLevelNum : 0
         * rainfallNum : 4
         * meteorologicalNum : 2
         */

        private int waterLevelNum;
        private int rainfallNum;
        private int meteorologicalNum;
        private String msg_source;
        private String projectCodeDesc;

        public int getProjectCodeDescVisible(){
            return StringUtil.isEmpty(projectCodeDesc)?View.GONE:View.VISIBLE;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getBusinessCode() {
            return businessCode;
        }

        public void setBusinessCode(String businessCode) {
            this.businessCode = businessCode;
        }

        public String getType() {
            return StringUtil.isEmpty(type) ? getWarnType() : type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public int getUserId() {
            return userId;
        }

        public void setUserId(int userId) {
            this.userId = userId;
        }

        @Bindable
        public int getIsRead() {
            return isRead == 1 ? View.GONE : View.VISIBLE;
        }

        public void setIsRead(int isRead) {
            this.isRead = isRead;
            notifyPropertyChanged(BR.isRead);

        }

        public Object getCreateBy() {
            return createBy;
        }

        public void setCreateBy(Object createBy) {
            this.createBy = createBy;
        }

        public String getCreateTime() {
            return createTime;
        }

        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }

        public Object getUpdateBy() {
            return updateBy;
        }

        public void setUpdateBy(Object updateBy) {
            this.updateBy = updateBy;
        }

        public Object getUpdateTime() {
            return updateTime;
        }

        public void setUpdateTime(Object updateTime) {
            this.updateTime = updateTime;
        }

        public int getIsDelete() {
            return isDelete;
        }

        public void setIsDelete(int isDelete) {
            this.isDelete = isDelete;
        }

        public String getTypeName() {
            return StringUtil.isEmpty(typeName) ? getWarnTypeName() : typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getNoticeNum() {
            return noticeNum;
        }

        public void setNoticeNum(int noticeNum) {
            this.noticeNum = noticeNum;
        }

        public int getApprovalNum() {
            return approvalNum;
        }

        public void setApprovalNum(int approvalNum) {
            this.approvalNum = approvalNum;
        }

        public String getWarnType() {
            return StringUtil.isEmpty(warnType) ? "" : warnType;
        }

        public void setWarnType(String warnType) {
            this.warnType = warnType;
        }

        public String getWarnTypeName() {
            return warnTypeName;
        }

        public void setWarnTypeName(String warnTypeName) {
            this.warnTypeName = warnTypeName;
        }

        public int getWaterLevelNum() {
            return waterLevelNum;
        }

        public void setWaterLevelNum(int waterLevelNum) {
            this.waterLevelNum = waterLevelNum;
        }

        public int getRainfallNum() {
            return rainfallNum;
        }

        public void setRainfallNum(int rainfallNum) {
            this.rainfallNum = rainfallNum;
        }

        public int getMeteorologicalNum() {
            return meteorologicalNum;
        }

        public void setMeteorologicalNum(int meteorologicalNum) {
            this.meteorologicalNum = meteorologicalNum;
        }

        public String getMsg_source() {
            return msg_source;
        }

        public void setMsg_source(String msg_source) {
            this.msg_source = msg_source;
        }

        public String getProjectCodeDesc() {
            return projectCodeDesc;
        }

        public void setProjectCodeDesc(String projectCodeDesc) {
            this.projectCodeDesc = projectCodeDesc;
        }
    }
}
